<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>零部件信息列表</title>
		<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/list.css"/>
		<link rel="stylesheet" href="../../css/ztree/productTree.css" type="text/css">
		<link rel="stylesheet" href="../../css/zTreeStyle/zTreeStyle.css" type="text/css">
		<style>
			/* 工艺管理弹框样式 */
			
			.input_radio2 {
				width: 300px;
				height: 300px;
				text-align: center;
				position: absolute;
				top: 50%;
				left: 50%;
				margin-left: -150px;
				margin-top: -100px;
				background: rgb(245, 245, 245);
				border: 1px solid rgb(200, 200, 200);
				box-shadow: 5px 5px 5px rgb(100, 100, 100);
			}
			
			.input_radio2 p {
				text-align: center;
				height: 30px;
				background: rgb(68, 161, 248);
				line-height: 30px;
				color: white;
				margin-bottom: 25px;
			}
			
			.input_radio2 p {
				text-align: center;
				height: 30px;
				background: rgb(68, 161, 248);
				line-height: 30px;
				color: white;
				margin-bottom: 25px;
			}
			
			.input_radio2 .fs-wrap {
				width: 200px;
			}
			
		</style>
	</head>
	<body>
		<!-- 蓝色背景区域 -->
		<div class="wrap"> 
			<!-- 白色可用区域 -->
			<div class="canuse">
				<!------ 位置 ------>
	            <p class="contentText local"><span>位置：基础数据管理 > 零部件信息</span></p>
	            
	            <div class = "flex-td-15 floatLeft" style="height: 100%;background: rgb(245, 250, 255);min-height: 400px;">
	            	<input style="width: 82px; margin: 5px 0 0 10px;" type="text" name="" id="projectSearch" value="" />
					<span style="margin-left: 10px; text-indent: 22px;" class="bgd_blue_search" onclick="TaskList.projectSearch();">查询</span>
					<div  id="productTree" class="ztree"></div>
				</div>
	            <div class = "flex-td-85 floatLeft">
	            <!-- 列表区 -->
	            <div class="show_list">
                	<div class="title_operate">
                    	<h4 class="sel_title"><img src="../../img/list/brand1.png" /><span>零部件信息列表</span></h4>
                		
                        <!-- 操作类型区 -->
                        <div class="operate_area">
                           <!-- <a href="partsInfoAdd.html" class="bgd_add img_hand">增加</a> -->
                           <a class="bgd_export img_hand" id="downloadEBOMTemplate">模板</a>
                           <a class="bgd_modify img_hand" id="exportBOM">导入</a>
                           
                            <a id="del" class="bgd_delete img_hand">删除</a> 
                        </div>
                	</div>
                	<div class="list_area">
                        <!-- 信息列表区 -->
                        <div class="info_area">
                            <table class="tablelist" border="1" cellspacing="0" cellpadding="0">
                                <tbody>
                                    <tr class="menuText list_head">
                                        <th class="checkSelectAll"></th>
                                        <th class="">零部件号</th>
                                        <th class="">零部件名称</th>
                                        <th class="">零部件类型</th>
                                        <th class="">拼板数量</th>
                                        <th class="">产品代号</th>
                                        <th class="">产品名称</th>
                                        <th class="">是否可打码</th>
                                        
                                        <th class="">主管人</th>
                                        <th class="">创建人</th>
                                        <th class="">创建时间</th>
                                        <th class="">修改人</th>
                                        <th class="">创建时间</th>
                                        <th class="">备注</th>
                                    </tr>
                                </tbody>
                                <tbody class="tablelist">
                                    <tr class="listTableText list_list">
                                        <td><input type="checkbox" class="input_checkBox" name="" id="" value=""></td>
                                        <td><a class="cursor editBlue" href="partsInfoUpdate.html">010</a></td>
                                        <td>零部件一</td>
                                        <td>类型一</td>
                                        <td>15</td>
                                        <td>A-001</td>
                                        <td>产品2</td>
                                        <td>是</td>
                                        
                                        <td>administrator</td>
                                        <td>admin</td>
                                        <td>2020-01-01</td>
                                        <td></td>
                                        <td></td>
                                        
                                        <td>备注测试</td>
                                    </tr>
                                    <tr class="listTableText list_list">
                                        <td><input type="checkbox" class="input_checkBox" name="" id="" value=""></td>
                                        <td><a class="cursor editBlue" href="partsInfoUpdate.html">020</a></td>
                                        <td>零部件二</td>
                                        <td>类型二</td>
                                        <td>15</td>
                                        <td>A-001</td>
                                        <td>产品1</td>
                                        <td>是</td>
                                        
                                        <td>administrator</td>
                                        <td>admin</td>
                                        <td>2020-01-01</td>
                                        <td></td>
                                        <td></td>
                                        
                                        <td>备注测试</td>
                                    </tr>
                                    <tr class="listTableText list_list">
                                        <td><input type="checkbox" class="input_checkBox" name="" id="" value=""></td>
                                        <td><a class="cursor editBlue" href="partsInfoUpdate.html">030</a></td>
                                        <td>零部件三</td>
                                        <td>类型一</td>
                                        <td>15</td>
                                        <td>A-001</td>
                                        <td>产品1</td>
                                        <td>是</td>
                                        
                                        <td>administrator</td>
                                        <td>admin</td>
                                        <td>2020-01-01</td>
                                        <td></td>
                                        <td></td>
                                        
                                        <td>备注测试</td>
                                    </tr>
                                </tbody>

                            </table>
                        </div>
	                    <!-- 页码区域 -->
	                    <div class="page_area contentText clear">
	                    	<div class="page_sum">
	                    		共<span class="page_number"> 3 </span>页&emsp;每页 10 条&emsp;共<span class="info_sum"> 3 </span>条记录
	                    	</div>
	                        <div class="page_jump">
	                        	<span>跳转到&emsp;第</span>
	                        	<input type="text" name="" id="" value="" />
	                        	<span>页&emsp;</span>
	                        	<button>Go</button>
	                        </div>
	                        <div class="page-pull-right async-page">
	                            <button>上一页</button>
	                            <button class="select_page">1</button>
	                            <button>2</button>
	                            <button>3</button>
	                            <button style="color: rgb(30, 30, 30);">▪▪▪</button>
	                            <button>98</button>
	                            <button>99</button>
	                            <button>100</button>
	                            <button>下一页</button>
	                        </div>
	                    </div>
                    </div>
                </div>
                </div>
			</div>
			<div id="exportBOMDiv" class="mask hidden">
									<div class="input_radio2">
										<p>导入产品</p>
										<div id="popWindow">
											请选择：<input type="file" id="productTechnologyInput">
										</div>
										<div style="position: absolute;bottom: 10px;left: 75px;">
											<input class="bgd_blue_two img_hand contenText" type="button" value="提交" onclick="exportBOMFile()">
											<input class="bgd_blue_two img_hand contenText" type="button" value="取消" onclick="cancel()">
										</div>
									</div>
								</div>
			<!-- 版尾  -->
			<div class="ending">
				Copyright© 2019-2020 磐基技术有限公司
			</div>
			
			<!-- 等待加载 -->
			<!--<div class="loader"><p class="load_hint">请等待加载••••••</p></div>-->
			
		</div>
	</body>
   <script src='../../js/3rd/jquery-1.9.1.min.js' type='text/javascript' charset='utf-8'></script>	
	<script type="text/javascript" src="../../js/3rd/ztree/jquery.ztree.core.product-3.5.js"></script>
	<script type="text/javascript" src="../../js/3rd/ztree/jquery.ztree.excheck-3.5.js"></script>
	<script type="text/javascript" src="../../js/3rd/ztree/jquery.ztree.exedit-3.5.js"></script>
	
		<script src='../../js/common/common.js' type='text/javascript' charset='utf-8'></script>
	
		<script type="text/javascript">
			
		// 点击下载EBOM模板
		$("#downloadEBOMTemplate").click(function() {
			alert("下载零部件模板");
		});
			// 导入
		$("#exportBOM").click(function() {
			$("#exportBOMDiv").removeClass("hidden");
		});

		//弹框点击取消
		function cancel() {
			$("#exportBOMDiv").addClass("hidden");
		}

		// 点击提交
		function exportBOMFile() {
			$("#exportBOMDiv").addClass("hidden");
		}
			// 批量删除工艺
		$("#del").click(function(){
			var list = [];//项目中要删除的id集合
			var checks = $("input[type='checkbox']:checked");
			$.each(checks,function(index, obj) {
				list.push(obj.id);
			});
		
			if(list.length <= 0) {
				alert("请至少选择一条数据");
				return;
			}
			
			window.confirm("确定要删除吗?",function(result){
			
			});
	});
	
	
	/* 零部件信息管理 */
		var setting = {
			edit: {
				enable: false,
				drag: {
	                isCopy: false,//所有操作都是move
	                isMove: true,
	                prev: true,
	                next: true,
	                inner: true
	            }
			},
			 data: {
	            key:{
	                name:"name"
	            },
	            simpleData: {
	                enable: true,
	                idKey:"id",
	                pIdKey:"pId",
	                rootPid: ""
	            }
        	},
			callback: {
				 beforeDrag: beforeDrag,
	            beforeDrop: beforeDrop,
	            onDrop: onDrop
			}
		};


		var log, className = "dark";
		//在拖拽之前
	    function beforeDrag(treeId, treeNodes) {
	        for (var i=0,l=treeNodes.length; i<l; i++) {
	            if (treeNodes[i].drag === false) {
	                return false;
	            }
	        }
	        return true;
	    }
	    //用于捕获节点拖拽操作结束之前的事件回调函数，并且根据返回值确定是否允许此拖拽操作
	    //默认值 null
	    function beforeDrop(treeId, treeNodes, targetNode, moveType) {
	        return targetNode ? targetNode.drop !== false : true;
	    }
	    //用于捕获节点拖拽操作结束的事件回调函数  默认值： null
	    function onDrop(event, treeId, treeNodes, targetNode,moveType) {
	        //拖拽成功时，修改被拖拽节点的pid
	        console.log(event)
	        console.log(treeId +'11111')
	        console.log(treeNodes )
	        console.log(treeNodes[0].parentCode)
	        console.log(targetNode)
	        console.log(moveType)
	    }

		var zNodes =[
			{ id:1, pId:0, name:"产品1", open:true},
			{ id:11, pId:1, name:"零件 1-1"},
			{ id:12, pId:1, name:"零件 1-2"},
			{ id:13, pId:1, name:"零件 1-3"},
				{ id:14, pId:1, name:"零件 2-2(产品2)"},
			{ id:2, pId:0, name:"产品 2", open:true},
			{ id:21, pId:2, name:"零件 2-1"},
			{ id:22, pId:2, name:"零件 2-2"},
			{ id:3, pId:0, name:"产品 3", open:true},
			{ id:31, pId:3, name:"零件 3-1"},
			{ id:32, pId:3, name:"零件 3-2"},
			{ id:33, pId:3, name:"零件 3-3"},
			{ id:4, pId:0, name:"通用产品", open:true},
			{ id:41, pId:4, name:"通用零部件"}
		];
		
		/* 初始化数据 */
			$.fn.zTree.init($("#productTree"), setting, zNodes);
		
		/* 点击增加产品按钮 */
		function addProductParts(){
			window.location.href="partsInfoAdd.html";
		}
		
			
		</script>
</html>
